
package es.udc.emarketapp.http.controller.actions.general;

import es.udc.emarketapp.http.controller.session.SessionManager;
import es.udc.emarketapp.http.controller.session.shoppingManager.ShoppingManager;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.struts.action.DefaultAction;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;



public class LogoutAction extends DefaultAction {

	public ActionForward doExecute(ActionMapping mapping, ActionForm form, 
			HttpServletRequest request, HttpServletResponse response) 
			throws IOException, InternalErrorException {
	        
	        /* Do logout. */

	        SessionManager.logout(request, response);
                ShoppingManager.emptyCart(request);
	        
	        /* Return ActionForward. */
	        return mapping.findForward("success");
	    
	    }
}
